home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’95 / Menu Controls / UShapeView.h < prev    next >
Encoding:
Text File  |  1995-06-24  |  2.0 KB  |  72 lines  |  [TEXT/MPS ]

  1. // Copyright © 1994-95 by Apple Computer, Inc. All rights reserved.
  2. // UDrawShapes.h
  3.  
  4. #ifndef __USHAPEVIEW__
  5. #define __USHAPEVIEW__
  6.  
  7. #ifndef __UVIEW__
  8. #include <UView.h>
  9. #endif
  10.  
  11. class TShape;
  12. class TShapeDocument;
  13.  
  14. //--------------------------------------------------------------------------------------------------
  15. // TShapeView
  16. //--------------------------------------------------------------------------------------------------
  17. class TShapeView : public TView
  18. {
  19.     MA_DECLARE_CLASS;
  20.  
  21.   public:
  22.     TShapeView();
  23.  
  24.     void IShapeView(TShapeDocument* itsDocument, Boolean forClipboard);
  25.  
  26.     virtual void DoPostCreate(TDocument* itsDocument);    // Override
  27.  
  28.     // • Size determination
  29.     virtual void CalcMinFrame(VRect& minFrame); // Override
  30.  
  31.     // • Commands
  32.     virtual void DoMenuCommand(CommandNumber aCommandNumber); // Override
  33.     virtual void DoSetupMenus(); // Override
  34.  
  35.     virtual void DoMouseCommand(VPoint& theMouse,
  36.                                 TToolboxEvent* event,
  37.                                 CPoint hysteresis); // Override
  38.  
  39.     // • Screen display
  40.     virtual void DoHighlightSelection(HLState fromHL, HLState toHL); // Override
  41.     virtual void DoSetCursor(const VPoint& localPoint, RgnHandle cursorRegion); // Override
  42.     virtual void Draw(const VRect& area); // Override
  43.  
  44.     void InvalShape(TShape* aShape);
  45.  
  46.     // • State transition
  47.     void Deselect();
  48.     void RestoreSelection();
  49.     void SaveSelection(Boolean andInval);
  50.  
  51.     // • Methods only relevant for a shapeView installed in the Clipboard
  52.     virtual Boolean ContainsClipType(ResType aType); // Override
  53.     virtual void WriteToDeskScrap(); // Override
  54.     void ReadFromDeskScrap();
  55.  
  56.     // • Misc
  57.     inline Boolean IsDragging() { return fDragging; };
  58.     inline void SetDragging(Boolean dragging) { fDragging = dragging; };
  59.  
  60.     TShapeDocument*    fShapeDocument;        // the associated document which owns the shapes
  61.     CPoint            fClickPt;            // on Paste, this is where the top-left point of the
  62.                                         // clipboard boxes go
  63.   private:
  64.     Boolean            fDragging;            // tells us whether the mouse is dragging
  65.  
  66.     Boolean IsMenuColor(CommandNumber aCommandNumber);
  67.     void PickColor();
  68.     void SelectAllShapes();
  69. };
  70.  
  71. #endif
  72.